const Router = require('koa-router')
const router = new Router({ prefix: '/users'})
const userControllers = require('../controllers/userControllers')
  
// const auth = async (ctx,next) => {
//     if (ctx.url !== '/users') {
//       console.log(111111)
//       ctx.throw(401)
//     }
//     console.log(222222)
//     await next()
// }

router.get('/',userControllers.find)

router.post('/',userControllers.create)

router.get('/:id', userControllers.findById)

router.put('/:id',userControllers.update)

router.delete('/:id', userControllers.delete)

 module.exports = router